// 导入axios
import axios from 'axios'
import { ElMessage } from 'element-plus'

// 创建一个axios实例
const instance = axios.create({
  baseURL: 'http://localhost:8888/lbs', // 

  headers: {
    'Access-Control-Allow-Origin': '*',
    'content-type': 'application/json',
  },

  // withCredentials: true,
  timeout: 500000, // 500秒
})

// http 拦截器
const reqOnFulfilled = (config) => {
  return config
}

const reqOnRejected = (error) => {
  return Promise.reject(error)
}

instance.interceptors.request.use(reqOnFulfilled, reqOnRejected)

const resOnFulfilled = (response) => {
  return response
}

const resOnRejected = (error) => {
  return Promise.reject(error)
}

instance.interceptors.response.use(resOnFulfilled, resOnRejected)
export default instance